﻿@namespace BootstrapBlazor.Components
@inherits BootstrapComponentBase

<div @attributes="AdditionalAttributes" class="@ClassString" @ref="ImageElement">
    @if (ShowImage)
    {
        @RenderChildContent()
    }
    else if (ShouldRenderPlaceHolder)
    {
        @PlaceHolderTemplate
    }

    @if (ShowPreviewList)
    {
        <ImagePreview ZIndex="@ZIndex" PreviewList="PreviewList" />
    }
</div>

@code {
    RenderFragment RenderErrorTemplate() =>
    @<div class="bb-img-holder bb-img-error">
        <div class="bb-img-loading">
            <i class="fa fa-file-picture-o fa-2x"></i>
        </div>
    </div>;

    RenderFragment RenderPlaceHolder() =>
    @<div class="bb-img-holder">
        <div class="bb-img-loading">
            <Spinner Color="Color.Primary" />
        </div>
    </div>;
}

